import Layout from '@/layout/index.vue'
import { AppRouteRecordRaw } from '../types'
import { Role } from '@/models/user-info'

const productRouter: AppRouteRecordRaw[] = [
  {
    path: '/product',
    component: Layout,
    redirect: '/product/list',
    meta: {
      sort: 2,
      title: '产品中心',
      roles: [Role.admin]
    },
    children: [
      {
        path: 'list',
        name: 'ProductList',
        component: () => import('@/views/products/product-list.vue'),
        meta: {
          title: '产品列表'
        },
        children: [
          {
            path: 'a',
            name: 'ProductListAAA',
            component: () => import('@/views/products/product-list-a.vue'),
            meta: {
              title: '产品列表 A'
            }
          },
          {
            path: 'b',
            name: 'ProductDetailSSS',
            component: () => import('@/views/products/product-list-b.vue'),
            meta: {
              title: '产品列表 B'
            }
          }
        ]
      },
      {
        path: 'detail',
        name: 'ProductDetail',
        component: () => import('@/views/products/product-detail.vue'),
        meta: {
          title: '产品详情'
        }
      }
    ]
  }
]

export default productRouter
